package com.mk.interceptor.wbheader;

import act.app.ActionContext;
import com.mk.domain.ZMembers;
import com.mk.enums.ErrorCode;
import org.osgl.mvc.result.RenderJSON;
import org.osgl.mvc.result.Result;

@SuppressWarnings("unused")
public interface WbPermissionInterface {
    ZMembers me();

    void login(ZMembers members);

    void logout();

    default boolean isLogin() {
        return me() != null;
    }

    default Result check(ActionContext context) {
        //是否登录
        if (!isLogin()) {
            return RenderJSON.of(ActionContext.current().successStatus(), ErrorCode.E201003.map());
        }
        return null;
    }
}
